﻿using System;

namespace Algobox.Objects.Finance.Prices
{
    public class PriceVolume : IPriceVolume
    {
        public PriceVolume(PriceType type)
        {
            _type = type;
        }

        public PriceVolume(PriceType type, double price, ulong volume)
        {
            _price = price;
            _volume = volume;
            _type = type;
        }

        public PriceVolume(PriceType type, double price, ulong volume, DateTime timeStamp)
        {
            _price = price;
            _volume = volume;
            _timeStamp = timeStamp;
            _type = type;
        }

        double _price;
        ulong _volume;
        DateTime _timeStamp;
        PriceType _type;

        public double Price { get { return _price; } set { _price = value; } }
        public ulong Volume { get { return _volume; } set { _volume = value; } }
        public DateTime TimeStamp { get { return _timeStamp; } set { _timeStamp = value; } }
        public PriceType Type { get { return _type; } set { _type = value; } }
        
        public override string ToString()
        {
            return Volume + "@" + Price;
        }

        public void Update(double price, ulong volume)
        {
            _price = price;
            _volume = volume;
        }

        public void Update(double price, ulong volume, DateTime timeStamp)
        {
            _price = price;
            _volume = volume;
            _timeStamp = timeStamp;
        }
        
        public enum PriceType
        {
            Bid,
            Ask,
            Last
        }
    }
}
